package com.itheima.boot.service.impl;

import com.itheima.boot.domain.Book;
import com.itheima.boot.mapper.BookMapper;
import com.itheima.boot.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookMapper bookMapper;

    public boolean save(Book book) {
        return bookMapper.save(book) > 0;
    }

    public boolean update(Book book) {
        return bookMapper.update(book) > 0;
    }

    public boolean delete(Integer id) {
        return bookMapper.delete(id) > 0;
    }

    public Book getById(Integer id) {

        return bookMapper.getById(id);
    }

    public List<Book> getAll( String bookName,Integer status) {
//        return bookMapper.getAll();
        return bookMapper.getAll(bookName,status);
    }

//    @Override
//    public List<Book> selectByCondition(Integer status, String bookName) {
//        return bookMapper.selectByCondition(status,bookName);
//    }
}
